import Vue from 'vue'
import VueRouter from 'vue-router'
import MovieView from '../views/MovieView.vue'
import CinemaView from '../views/CinemaView.vue'
import MineView from '../views/MineView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'cinema',
    
  },
  {
    path: '/movie',
    name: 'movie',
    component: MovieView,
    children:[{
      path:'city',
      component:() => import('@/components/City.vue')
    },{
      path:'now',
      component:() => import('@/components/Now.vue')
    },{
      path:'coming',
      component:() => import('@/components/Coming.vue')
    },{
      path:'search',
      component:() => import('@/components/Search.vue')
    }],
    redirect:'/movie/now'
  },
  {
    path: '/cinema',
    name: 'cinema',
    component: CinemaView
  },
  {
    path: '/mine',
    name: 'mine',
    component: MineView
  },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/MovieView.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
